// 例子3

{
    function fn() {
        var a = 1;
        let a = 10;
    }

    try {
        fn(); // Uncaught SyntaxError: Identifier 'a' has already been declared
    } catch (e) {
        console.error(e);
    }

}

console.log('------------------------------------------------')

{
    function fn() {
        let a = 10;
        let a = 1;
    }

    try {
        fn(); // Uncaught SyntaxError: Identifier 'a' has already been declared
    } catch (e) {
        console.error(e);
    }
}

console.log('------------------------------------------------')

{
    function fn() {
        const a = 10;
        let a = 1;
    }

    try {
        fn(); // Uncaught SyntaxError: Identifier 'a' has already been declared
    } catch (e) {
        console.error(e);
    }
}